package org.eclipse.unofficial.flexitabs;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.unofficial.flexitabs.FlexiTab;
import org.eclipse.unofficial.flexitabs.FlexiTabClient;
import org.eclipse.unofficial.flexitabs.FlexiTabContainer;
import org.junit.Test;


import junit.framework.TestCase;


public class TestFlexiTab extends TestCase {

	@Test
	public void testImagePadder(){		
		SwtUtil.openShell(new SwtUtil.GenericShellClient(){
			@Override
			public void addToShell(final Shell shell) {
				FlexiTabContainer container = new FlexiTabContainer(shell);
				container.addTab(new TestTab());
//				container.addTab(new TestTab());
//				container.addTab(new TestTab());
//				container.deactivate();
			}
		});
	}
	
	private class TestTab implements FlexiTabClient {
		private FlexiTab tab; 
		
		@Override
		public Composite makeComposite(Composite parent) {
			parent.setLayout(new FillLayout());
			
			Composite cmp = new Composite(parent, SWT.NONE);
			cmp.setLayout(new FillLayout());
			
			Text txt = new Text(cmp, SWT.BORDER | SWT.MULTI);
			txt.setText("Test text.");
			
			return cmp;
		}

		@Override
		public void setTab(FlexiTab tab) {
			this.tab = tab;
			this.tab.setText("Test");
		}

		@Override
		public void setFocus() {
			
		}
	}
}
